package com.etc.service.impl;

import com.etc.dao.BooksMapper;
import com.etc.entity.Books;
import com.etc.service.BooksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BooksServiceImpl implements BooksService {
    @Autowired
    BooksMapper dao;

    @Override
    public boolean deleteByPrimaryKey(Integer bId) {
        int i = dao.deleteByPrimaryKey(bId);
        return i>0;
    }

    @Override
    public boolean insert(Books record) {
        int i = dao.insert(record);
        return i>0;
    }

    @Override
    public List<Books> selectByPrimaryKey(String bName) {
        return dao.selectByPrimaryKey("%"+bName+"%");
    }

    @Override
    public boolean updateByPrimaryKey(Books record) {
        int i = dao.updateByPrimaryKey(record);
        return i>0;
    }
}
